package cn.com.yang.egg;

/**
 * @Desc<...>
 * @Author 杨亿金
 * @Date 2021/1/15 15:29
 * @CopyRight
 * @Version
 */
public class FieldHasNoPolymorphic {
    static class Father {
        public int money = 1;

        public Father() {
            money = 2;
            showMeTheMoney();
        }

        public void showMeTheMoney() {
            System.out.println("I'm father,i have $ " + money);
        }
    }

    static class Son extends Father {
        public int money = 3;

        public Son() {
            money = 4;
            showMeTheMoney();
        }

        // shift + alt + up
        public void showMeTheMoney() {
            System.out.println("I'm son,i have $ " + money);
        }
    }

    public static void main(String[] args) {
        Father gay = new Son();
        System.out.println("this is gay,i have $ "+gay.money);
        /**
         * I'm son,i have $ 0
         * I'm son,i have $ 4
         * this is gay,i have $ 2
         */
    }
}
